<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="net.sf.antcontrib.logic.ForEach"%>
<%@page import="br.ufpe.cin.rgms.membro.modelo.Membro"%>
<%@page import="br.ufpe.cin.rgms.linhapesquisa.modelo.LinhaPesquisa"%>
<%@page import="java.util.List"%>
<%@page import="br.ufpe.cin.rgms.Facade"%>

<%@page import="java.util.ArrayList"%>
<%@page import="java.util.HashMap"%>

<%@page import="br.ufpe.cin.rgms.util.Properties"%>

<html>

<head>
<title><%out.println(Properties.getProperty(this.getServletContext(),"time_pesquisa"));%></title>
<LINK REL=StyleSheet HREF="style.css" TYPE="text/css" MEDIA=screen>
</head>

<body>

<div id="page">
	<div id="header"></div>
	
	<div id="mainarea">
	<div id="sidebar">
		<div id="headerleft">
			<h1><a href="home.jsp"><%out.println(Properties.getProperty(this.getServletContext(),"time_pesquisa"));%></a></h1>
		</div>
		<div id="menulinks">
			<a href="home.jsp"><%out.println(Properties.getProperty(this.getServletContext(),"home"));%></a>
			<a href="membros.jsp"><%out.println(Properties.getProperty(this.getServletContext(),"membros"));%></a>
			<a href="publicacoes.jsp"><%out.println(Properties.getProperty(this.getServletContext(),"publicacoes"));%></a>
			<a class="active" href="linhaspesquisas.jsp"><%out.println(Properties.getProperty(this.getServletContext(),"linhaspesquisas"));%></a>
			<a href="contato.jsp"><%out.println(Properties.getProperty(this.getServletContext(),"contato"));%></a>
		</div>
	</div>
		
	
	<div id="contentarea">
<h2><%out.println(Properties.getProperty(this.getServletContext(),"linhapesquisa_titulo"));%></h2>

<% 
				Object formsFieldsObject = request.getAttribute("campos");
				
				HashMap<String,String> formsFields = null;
				
				if(formsFieldsObject != null){
					formsFields = (HashMap<String,String>) formsFieldsObject;
				}
			 %>
<div id="filter">

<FORM name="filtrarlinhaspesquisa" action="FiltrarLinhaPesquisas.do" method="POST">
<p><LABEL for="titulo"><%out.println(Properties.getProperty(this.getServletContext(),"titulo"));%> </LABEL> <INPUT
	onkeypress="return noenter();" type="text" name="titulo" size="50"
	value="<%   if(formsFields != null && formsFields.get("titulo") != null) out.print(formsFields.get("titulo"));%>">

<p>
   <INPUT value=<%out.println(Properties.getProperty(this.getServletContext(),"filtrar"));%> type="submit"> 
   <INPUT value=<%out.println(Properties.getProperty(this.getServletContext(),"limpar"));%> type="reset"></p>
</FORM>
</div>

<table align=center>
	<% 
		Object linhasPesquisasObject = request.getAttribute("linhaspesquisas");
		List<LinhaPesquisa> linhaspesquisas = new ArrayList<LinhaPesquisa>();
		
		if(linhasPesquisasObject != null){
			linhaspesquisas = (List<LinhaPesquisa>) linhasPesquisasObject;
		}
		else{
			linhaspesquisas = Facade.getInstance().getLinhasPesquisas();
		}
		
		LinhaPesquisa linhaspesquisaAnterior = null;
		
		out.print("<div id=\"filtermessage\">");
		
		if(linhaspesquisas .isEmpty() && linhasPesquisasObject != null){
			out.print("<br><br><p>"+Properties.getProperty(this.getServletContext(),"sem_linhas_criterios")+"</p>");
		}
		else if(linhaspesquisas .isEmpty()){
			out.print("<br><br><p>"+Properties.getProperty(this.getServletContext(),"sem_linhas")+"</p>");
		}
		
		out.print("</div>");
		
		for (LinhaPesquisa linhapesquisa : linhaspesquisas){
			out.print("</tr>");
			out.print("<td><a href=DetalharLinhaPesquisa.do?linhapesquisa=" + linhapesquisa.getId() + "> "+ linhapesquisa.getTitulo()+ "</a></td>");
			out.print("<td>" + linhapesquisa.getDescricaoBasica()+ "</td>");
		}
		
		 %>
</table>

<br>
<br>
<br>

<table align=center>
	<tr>
		<td>
		<form id="botaoAdicionar" action="adicionarlinhapesquisa.jsp"><input
			value=<%out.println(Properties.getProperty(this.getServletContext(),"adicionar"));%> type="submit"></form>
		</td>
	</tr>
</table>
</div>


<div id="footer"><a href="http://www.free-css-templates.com/">Designed
by Free CSS Templates</a>, Thanks to <a href="http://www.openwebdesign.org/">professional
web design</a></div>


</body>

</html>